package com.yanqu.road.server.cmd.union;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.union.UnionProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.union.UnionMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

//@Cmd(code = GameProtocol.S_UNION_CHANGE_APPLY_TITLE,desc = "")
public class ChangeUnionApllyTitleCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        UnionProto.ChangeUnionApplyTitleLimitReqMsg reqMsg = UnionProto.ChangeUnionApplyTitleLimitReqMsg.parseFrom(packet.getBytes());
        int title = reqMsg.getTitle();
        ret = UnionMgr.changeApplyTitle(player, title);
        UnionProto.ChangeUnionApplyTitleLimitRespMsg.Builder resp = UnionProto.ChangeUnionApplyTitleLimitRespMsg.newBuilder();
        resp.setRet(ret);
        resp.setTitle(title);
        player.sendPacket(ClientProtocol.U_UNION_CHANGE_APPLY_TITLE, resp);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
